#!/bin/bash

ENV=$1
echo "开始构建: $ENV "
echo "当前路径: $PWD"

if [ "$ENV" == "prod" ]; then
  echo "运行 cnpm install ,$ENV "
  cnpm install
  cnpm run build

   # 删除目标目录下的文件
      rm -rf /home/docker/nginxwebui/wwwroot/BigView/*
      # 拷贝文件到目标目录
      cp -r ./dist/* /home/docker/nginxwebui/wwwroot/BigView
else
   echo "运行 npm install ,$ENV "
   npm install
   npm run build:uat
    # 删除目标目录下的文件
    rm -rf /home/nginxwebui/wwwroot/BigView/*
    # 拷贝文件到目标目录
    cp -r ./dist/* /home/nginxwebui/wwwroot/BigView

fi

